
$(document).ready(function(){
    $('.datepicker').datepicker();


    $("#oper").val(geturlparam("oper") );
    $("#id").val(geturlparam("id") );
    $("#notifyinfo").validate({
        rules:{
            msgcontent:{
                required:true,
                maxlength:250,
                minlength:3
            },
            touserid:{
                required:true
            },
            expiredate:{
                required:true,
                date:true
            }




        },
        errorClass: "help-inline",
        errorElement: "span",
        highlight:function(element, errorClass, validClass) {
            $(element).parents('.control-group').addClass('error');
        },
        unhighlight: function(element, errorClass, validClass) {
            $(element).parents('.control-group').removeClass('error');
            $(element).parents('.control-group').addClass('success');
        },

        submitHandler: function(form) {  //通过之后回调
            var param = $("#notifyinfo").serialize();
            $.ajax({
                url : "notifyinfo.html",
                type : "post",
                dataType : "json",
                data: param,
                success : function(result) {

                    bootbox.dialog({
                        message: "<STRONG class=\"red\">"+result.info+"</STRONG>  <BR><BR>不继续操作则跳转到通知管理。继续操作吗？",
                        title: "通知/告警管理",
                        buttons: {
                            success: {
                                label: "继 续",
                                className: "btn-success",
                                callback: function() {
                                    /*if(result.status=="success")
                                     form.reset();*/
                                }
                            },
                            danger: {
                                label: "取 消",
                                className: "btn-danger",
                                callback: function() {
                                    window.location.href='notifyadmin.html';
                                }
                            }
                        }
                    });


                }
            });
        },
        invalidHandler: function(form, validator) {  //不通过回调
            return false;
        }
    });



});
